package com.tsugun.mediaplayer.view.fragment;

import android.app.Fragment;
import android.content.Context;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

import com.tsugun.mediaplayer.R;
import com.tsugun.mediaplayer.presenter.utils.SettingPreferenceHelper;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * 下载管理界面
 * Created by shize on 2017/4/20.
 */

public class AdviseFragment extends Fragment implements View.OnClickListener {

    @BindView(R.id.id_setting_advise_title)
    EditText mEdtTitle;
    @BindView(R.id.id_setting_advise_call)
    EditText mEdtCall;
    @BindView(R.id.id_setting_advise_submit)
    Button mBtnSubmit;

    private View mFragment;
    private Context mContext;
    private Unbinder unbinder;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mFragment = inflater.inflate(R.layout.fragment_advise, container, false);
        unbinder = ButterKnife.bind(this, mFragment);
        mContext = container.getContext();

        bindData();
        return mFragment;
    }

    /**
     * 绑定数据
     */
    private void bindData() {
        mBtnSubmit.setOnClickListener(this);
        setSettingTheme();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    public void setSettingTheme() {
        mBtnSubmit.setBackgroundTintList(new ColorStateList(new int[][]{new int[0]}, new int[]{
                SettingPreferenceHelper.INSTANCE.getThemeColorPreference(mContext)}));
    }

    @Override
    public void onClick(View v) {
        // 按钮点击事件
    }
}